home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Programming
/
Programming Languages
/
UCB Logo 3.0
/
CSLS
/
format
< prev
next >
Wrap
Text File
|
1992-09-04
|
2KB
|
128 lines
TO ADDWORD :WORD
IF NOT EMPTYP :LINE [MAKE "LINECOUNT :LINECOUNT+1]
MAKE "LINE LPUT :WORD :LINE
MAKE "LINECOUNT :LINECOUNT+COUNT :WORD
END
TO BREAK
IF EMPTYP :LINE [STOP]
MAKE "LINECOUNT :WIDTH
PUTLINE
NEWINDENT
IF :FILLING [SKIP :PARSKIP]
END
TO FORMAT :FROM :TO
OPENREAD :FROM
OPENWRITE :TO
SETREAD :FROM
SETWRITE :TO
INIT.VARS
LOOP
SETREAD []
SETWRITE[]
CLOSE :FROM
CLOSE :TO
END
TO INIT.VARS
MAKE "PAGEHEIGHT 66
MAKE "TOPMAR 6
MAKE "LINES 54
MAKE "LEFTMAR 7
MAKE "WIDTH 65
MAKE "FILLTAB 5
MAKE "NOFILLTAB 0
MAKE "PARSKIP 1
MAKE "SPACING 1
MAKE "STARTED "FALSE
MAKE "FILLING "TRUE
MAKE "PRINTED 0
MAKE "INLINE []
END
TO LOOP
IF PROCESS NEXTWORD [STOP]
LOOP
END
TO NEWINDENT
NEWLINE
MAKE "INDENT IFELSE :FILLING [:FILLTAB] [:NOFILLTAB]
MAKE "LINECOUNT :INDENT
END
TO NEWLINE
MAKE "LINE []
MAKE "INDENT 0
MAKE "LINECOUNT 0
END
TO NEXTWORD
IF NOT EMPTYP :INLINE [OP POPWORD FIRST :INLINE]
IF NOT :FILLING [BREAK]
MAKE "INLINE RL
IF WORDP :INLINE [BREAK OP []]
IF EMPTYP :INLINE [BREAK OP NEXTWORD]
IF EQUALP FIRST RUNPARSE :INLINE "|*| [RUN BF RUNPARSE :INLINE MAKE "INLINE []]
OP NEXTWORD
END
TO NOFILL
BREAK
MAKE "FILLING "FALSE
NEWINDENT
END
TO POPWORD :NEXTWORD
MAKE "INLINE BF :INLINE
OP :NEXTWORD
END
TO PROCESS :WORD
IF LISTP :WORD [OP "TRUE]
IF NOT :STARTED [START]
IF (:LINECOUNT+1+COUNT :WORD) > :WIDTH [PUTLINE]
ADDWORD :WORD
OP "FALSE
END
TO PUTLINE
REPEAT :LEFTMAR+:INDENT [TYPE "| |]
PUTWORDS :LINE ((COUNT :LINE)-1) (:WIDTH-:LINECOUNT) 0
NEWLINE
SKIP :SPACING
END
TO PUTWORDS :LINE :SPACES :FILLER :PERWORD
IF EMPTYP :LINE [STOP]
TYPE FIRST :LINE
IF :SPACES > 0 [MAKE "PERWORD INT ((:FILLER+:SPACES-1)/:SPACES)]
IF :FILLER > 0 [REPEAT :PERWORD [TYPE "| |]]
TYPE "| |
PUTWORDS BF :LINE (:SPACES-1) (:FILLER-:PERWORD) 0
END
TO SKIP :HOWMANY
BREAK
REPEAT :HOWMANY [PRINT []]
MAKE "PRINTED :PRINTED+:HOWMANY
IF :PRINTED < :LINES [STOP]
REPEAT :PAGEHEIGHT-:PRINTED [PRINT []]
MAKE "PRINTED 0
END
TO START
MAKE "STARTED "TRUE
REPEAT :TOPMAR [PRINT []]
NEWINDENT
END
TO YESFILL
BREAK
IF NOT :FILLING [SKIP :PARSKIP]
MAKE "FILLING "TRUE
NEWINDENT
END